package cc.wsyw126.java.interview.sogou;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.DecimalFormat;

/**
 * Created by Administrator on 2017/9/8.
 */
public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int position = 0;
        double list[] = new double[n];
        double max = 0.0;
        while (position < n) {
            list[position] = Double.valueOf(br.readLine());
            position++;
        }
        Double aDouble = new Double(180.00000000);
        for (int j = 0; j < n; j++) {
            for (int i = j; i < n; i++) {
                list[i] = list[i] - list[j];
                if (list[i] > aDouble) {
                    list[i] = list[i] - aDouble;
                    if (list[i] > max ) {
                        max = list[i];
                    } else {
                        break;
                    }
                } else {
                    if (list[i] > max ) {
                        max = list[i];
                    }
                }
            }
        }
        DecimalFormat df = new DecimalFormat("######0.00000000");
        System.out.println(df.format(max));
    }

}
